Author: Michael Karcher <debian@mkarcher.dialup.fu-berlin.de>
Description: This patch removes non-portable pointer arithmetics and useless
 casts of pointers to integers.

--- unace-nonfree-2.5.orig/source/apps/exe/input/input.c
+++ unace-nonfree-2.5/source/apps/exe/input/input.c
@@ -169,6 +169,7 @@ CHAR      ShortStr1[80],
           TempStr[200];
 INT       TimeCount;
 UINT      ButtonNumber;
+PCHAR     ButtonPtr;
 PCHAR     Output;
 
   APPS_EXE_CONVERT_MakeStrShorter(ShortStr1, Description1, 79);
@@ -207,11 +208,11 @@ PCHAR     Output;
       APPS_EXE_INPUT.LastKey = APPS_EXE_MESSAGES.YANC[3];
     }
   }
-  while (!(ButtonNumber =
-             (LONG) strchr(APPS_EXE_MESSAGES.YANC, APPS_EXE_INPUT.LastKey))
+  while (!(ButtonPtr =
+             strchr(APPS_EXE_MESSAGES.YANC, APPS_EXE_INPUT.LastKey))
          && !BASE_ERROR_EXTERN_HandleCancel(0));
 
-  ButtonNumber -= (LONG) APPS_EXE_MESSAGES.YANC;
+  ButtonNumber = ButtonPtr - APPS_EXE_MESSAGES.YANC;
 
   if (!BASE_ERROR.ErrorCode)
   {
--- unace-nonfree-2.5.orig/source/apps/unace/exe/commline/commline.c
+++ unace-nonfree-2.5/source/apps/unace/exe/commline/commline.c
@@ -42,15 +42,17 @@
 
 void    APPS_UNACE_EXE_COMMLINE_Init(void)
 {
+  INT SearchExcludeListMax;
+  
   APPS_EXE_COMMLINE.TimeOutLimit = 600;
 
   BASE_FILELIST.SearchExcludeListEnd =
     BASE_FILELIST.SearchExcludeList  =
-        (PCHAR) BASE_MEMORY_GetMemBase2((PINT)
-                                        &BASE_FILELIST.SearchExcludeListMax,
+        (PCHAR) BASE_MEMORY_GetMemBase2(&SearchExcludeListMax,
                                         1);
 
-  BASE_FILELIST.SearchExcludeListMax += (INT) BASE_FILELIST.SearchExcludeList;
+  BASE_FILELIST.SearchExcludeListMax = SearchExcludeListMax + 
+                                       BASE_FILELIST.SearchExcludeList;
 
   APPS_EXE_OUTPUT.DoUseStdOutput = 1;
 
@@ -265,12 +267,12 @@ INT       Handle,
 
 void    APPS_UNACE_EXE_COMMLINE_GetFileListInit(void)
 {
+  INT SearchListMax;
   BASE_FILELIST.SearchListEnd =
     BASE_FILELIST.SearchList  =
-       (PCHAR) BASE_MEMORY_GetMemBase2((PINT)
-                                       &BASE_FILELIST.SearchListMax, 1);
+       (PCHAR) BASE_MEMORY_GetMemBase2(&SearchListMax,1);
 
-  BASE_FILELIST.SearchListMax += (INT) BASE_FILELIST.SearchListEnd;
+  BASE_FILELIST.SearchListMax = SearchListMax + BASE_FILELIST.SearchListEnd;
 }
 
 /*-----------------APPS_UNACE_EXE_COMMLINE_GetFileListDone---------------*/
--- unace-nonfree-2.5.orig/source/base/all/arcblk/arcblk.c
+++ unace-nonfree-2.5/source/base/all/arcblk/arcblk.c
@@ -218,8 +218,8 @@ void    BASE_ARCBLK_ConvertHeader32ToHea
           memmove(&BASE_ARCBLK.Header.File.FTIME,
                   &BASE_ARCBLK.Header.File32.FTIME,
                   sizeof(BASE_ARCBLK.Header)
-                  - ((ULONG)&BASE_ARCBLK.Header.File.FTIME
-                     - (ULONG)&BASE_ARCBLK.Header));
+                  - ((PCHAR)&BASE_ARCBLK.Header.File.FTIME
+                     - (PCHAR)&BASE_ARCBLK.Header));
 
           BASE_ARCBLK.Header.File.PSIZE = PSIZE;
           BASE_ARCBLK.Header.File.SIZE = SIZE;
@@ -239,8 +239,8 @@ void    BASE_ARCBLK_ConvertHeader32ToHea
           memmove(&BASE_ARCBLK.Header.Recovery.CLUSTER,
                   &BASE_ARCBLK.Header.Recovery32.CLUSTER,
                   sizeof(BASE_ARCBLK.Header)
-                  - ((ULONG)&BASE_ARCBLK.Header.Recovery.CLUSTER
-                     - (ULONG)&BASE_ARCBLK.Header));
+                  - ((PCHAR)&BASE_ARCBLK.Header.Recovery.CLUSTER
+                     - (PCHAR)&BASE_ARCBLK.Header));
 
           BASE_ARCBLK.Header.Recovery.REC_BLK_SIZE = REC_BLK_SIZE;
           BASE_ARCBLK.Header.Recovery.REL_STRT = REL_STRT;
@@ -259,8 +259,8 @@ void    BASE_ARCBLK_ConvertHeader32ToHea
               memmove(&BASE_ARCBLK.Header.Basic.other,
                 &BASE_ARCBLK.Header.Basic32.other,
                 sizeof(BASE_ARCBLK.Header)
-                  - ((ULONG)&BASE_ARCBLK.Header.Basic.other
-                  - (ULONG)&BASE_ARCBLK.Header));
+                  - ((PCHAR)&BASE_ARCBLK.Header.Basic.other
+                  - (PCHAR)&BASE_ARCBLK.Header));
 
             BASE_ARCBLK.Header.Basic.ADDSIZE = ADDSIZE; 
 
--- unace-nonfree-2.5.orig/source/base/all/archives/ace/ace.c
+++ unace-nonfree-2.5/source/base/all/archives/ace/ace.c
@@ -35,12 +35,12 @@ ULONGLONG FilePos,
     if (!memcmp(&BASE_ARCHIVES_TEST.TestBuffer[I], BASE_ACESTRUC_ACESIGN,
                 BASE_ACESTRUC_ACESIGNLEN)
         && (FilePos = BASE_DIRDATA_Dir1.ArchiveBegin + I
-                      - ((INT) BASE_ARCBLK.Header.Main.ACESIGN
-                      - (INT) &BASE_ARCBLK.Header))
+                      - ((PCHAR) BASE_ARCBLK.Header.Main.ACESIGN
+                       - (PCHAR) &BASE_ARCBLK.Header))
             >= 0)
     {
-      Flags = ((INT) BASE_ARCBLK.Header.Main.ACESIGN - (INT) &BASE_ARCBLK.Header);
-      Flags = ((INT) &BASE_ARCBLK.Header.Main.ACESIGN - (INT) &BASE_ARCBLK.Header);
+      Flags = ((PCHAR) BASE_ARCBLK.Header.Main.ACESIGN - (PCHAR) &BASE_ARCBLK.Header);
+      Flags = ((PCHAR) &BASE_ARCBLK.Header.Main.ACESIGN - (PCHAR) &BASE_ARCBLK.Header);
 
       BASE_DOSFUNCS_LSeek(BASE_ARCHIVES_TEST.ArchiveHandle, FilePos, SEEK_SET);
       read(BASE_ARCHIVES_TEST.ArchiveHandle, (PCHAR) &BASE_ARCBLK.Header, 4);
--- unace-nonfree-2.5.orig/source/base/all/filelist/filelist.c
+++ unace-nonfree-2.5/source/base/all/filelist/filelist.c
@@ -314,6 +314,7 @@ INT     BASE_FILELIST_Create(BOOL DoAddD
                              BOOL DoOutputNoFilesError)
 {
 PVOID     SavedScreenPtr;
+ULONG     PosIndex, LastIndex;
 
   BASE_MSGOUT_EXTERN_ListCreateBegin(&SavedScreenPtr);
 
@@ -344,14 +345,14 @@ PVOID     SavedScreenPtr;
                                 BASE_FILELIST.Number
                                   * sizeof(tBASE_FILELIST_FileData));
 
-  BASE_FILELIST.Pos  -= (ULONG) BASE_FILELIST.List;
-  BASE_FILELIST.Last -= (ULONG) BASE_FILELIST.List;
-
+  PosIndex  = BASE_FILELIST.Pos  - BASE_FILELIST.List;
+  LastIndex = BASE_FILELIST.Last - BASE_FILELIST.List;
+  
   BASE_FILELIST.List  = (PCHAR) BASE_MEMORY_ReAlloc(BASE_FILELIST.List,
-                                      (ULONG) BASE_FILELIST.Last);
+                                                    LastIndex);
 
-  BASE_FILELIST.Pos  += (ULONG) BASE_FILELIST.List;
-  BASE_FILELIST.Last += (ULONG) BASE_FILELIST.List;
+  BASE_FILELIST.Pos   = BASE_FILELIST.List + PosIndex;
+  BASE_FILELIST.Last  = BASE_FILELIST.List + LastIndex;
 
   BASE_MEMORY_Optimize();
 
--- unace-nonfree-2.5.orig/source/base/all/lfn/nont.c
+++ unace-nonfree-2.5/source/base/all/lfn/nont.c
@@ -131,7 +131,7 @@ CHAR      NumberStr[8];
     CharPos1 = &Name[strlen(Name)];
   }
 
-  Len = (UINT) CharPos1 - (UINT) Name;
+  Len = (PCHAR) CharPos1 - (PCHAR) Name;
 
   for (I = 0; I < Len; I++)
   {
--- unace-nonfree-2.5.orig/source/base/all/memory/memory.c
+++ unace-nonfree-2.5/source/base/all/memory/memory.c
@@ -238,8 +238,8 @@ INT       I, J;
 
   BASE_MEMORY_EXTERN_OptimizeOtherMemory();
 
-  I             = (INT) BASE_FILELIST.Last - (INT) BASE_FILELIST.List;
-  J             = (INT) BASE_FILELIST.Pos  - (INT) BASE_FILELIST.List;
+  I             = BASE_FILELIST.Last - BASE_FILELIST.List;
+  J             = BASE_FILELIST.Pos  - BASE_FILELIST.List;
   BASE_FILELIST.List = (PCHAR)BASE_MEMORY_ReAllocSameSize(BASE_FILELIST.List);
   BASE_FILELIST.Last = BASE_FILELIST.List + I;
   BASE_FILELIST.Pos  = BASE_FILELIST.List + J;
--- unace-nonfree-2.5.orig/source/base/all/pathfunc/pathfunc.c
+++ unace-nonfree-2.5/source/base/all/pathfunc/pathfunc.c
@@ -195,18 +195,18 @@ INT       SourceIndex,
 
   if (WildcardPos < PointPos && WildcardPos)
   {
-    SourceIndex = (LONG) WildcardPos - (LONG) SourceStr;
+    SourceIndex = WildcardPos - SourceStr;
   }
   else
   {
     if (PointPos)
     {
-      SourceIndex = (LONG) PointPos - (LONG) SourceStr;
+      SourceIndex = PointPos - SourceStr;
     }
     else
     {
       SourceIndex = WildcardPos ?
-                      (LONG) WildcardPos - (LONG) SourceStr :
+                      WildcardPos - SourceStr :
                       strlen(SourceStr);
     }
   }
@@ -227,7 +227,7 @@ INT       SourceIndex,
 
   if (PointPos)
   {
-    SourceIndex = (INT) PointPos - (INT) SourceStr + 1;
+    SourceIndex = PointPos - SourceStr + 1;
     CharsToCopy = 0;
 
     while (SourceStr[SourceIndex] && SourceStr[SourceIndex] != '*')
@@ -276,7 +276,7 @@ INT       Result;
         return 0;
       }
 
-      Result = (UINT) SlashPos - (UINT) Path + 1;
+      Result = SlashPos - Path + 1;
     }
     else
     {
@@ -323,7 +323,7 @@ PCHAR     SlashPos;
   }
 
   *SlashPos = 0;
-  SlashPos  = SlashPos - (UINT) Dir + (UINT) FileName;
+  SlashPos  = SlashPos - Dir + FileName;
 
   if (*SlashPos == BASE_PATHFUNC_SEPARATOR)
   {
